const net = require('net')

// 创建客户端连接
// const clientNet = net.createConnection(8124, '127.0.0.1')
const client = net.createConnection({ port: 8124 }, () => {
    //'connect' listener
    console.log('connected to server!');
    client.write('world!\r\n');
});
client.on('data', (data) => {
    console.log('data --- ', data.toString());
    client.end();
});
client.on('end', () => {
    console.log('disconnected from server');
});